Convert between binary, octal, decimal and hexadecimal in one place. Handy for programming and computer science homework.
Convert binary, octal, decimal and hexadecimal all at once
Enter a number and choose which base it is in (2, 8, 10 or 16), and this number base converter shows the same value in binary, octal, decimal and hexadecimal at once. It opens with decimal 255, so you immediately see binary 11111111, octal 377 and hex FF. Use it to read hex colour codes or bit values in programming, to check base-conversion answers for computer science homework, or to interpret memory addresses and octal permission values.
It first checks that every character is valid for the chosen base: 0 and 1 for binary, 0-7 for octal, 0-9 for decimal, and 0-9 plus A-F (lowercase works) for hex. If valid, the value is read as an integer and rewritten in all four bases, with hex letters shown in capitals. The manual method is the same idea. To convert to decimal, multiply each digit by the matching power of the base and add: binary 1011 is 1x8 + 0x4 + 1x2 + 1x1 = 11. To convert from decimal, divide repeatedly by the target base and read the remainders backwards: 11 is B in hex, 13 in octal and 1011 in binary. Results update as you type or change the base.
F is 15 and there are two digits, so 15 x 16 + 15 = 255. It is the largest value one byte (8 bits) can hold.
On and off are the two states an electrical circuit can tell apart most reliably. Hex is a human-friendly shorthand that packs four binary digits into one.
No. It handles whole numbers from 0 upward only. Two's complement for negatives and fractional base conversion need separate calculation.
Above about 9 quadrillion in decimal (2^53 - 1), a message says it cannot be converted exactly and no result is shown, so you never get a wrong value.
Posts · 0
No posts yet.